package com.ruoyi.web.controller.crm;

import com.bonuo.crm.domain.IndustryEducation;
import com.bonuo.crm.service.IndustryEducationService;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/crm/industryEducation")
@Api(tags = "产教融合")
public class IndustryEducationController extends BaseController {
    @Autowired
    private IndustryEducationService industryEducationService;

    @ApiOperation(value = "查询产教融合信息",httpMethod = "GET")
    @GetMapping("/list")
    public TableDataInfo list(IndustryEducation industryEducation, Integer pageNum, Integer pageSize) {
        if(pageNum!=null && pageSize!=null){
            startPage();
        }
        List<IndustryEducation> list = industryEducationService.selectIndustryEducationList(industryEducation);
        return getDataTable(list);
    }

    @ApiOperation(value = "添加产教融合信息",httpMethod = "POST")
    @PostMapping("/add")
    public AjaxResult add(@RequestBody IndustryEducation industryEducation) {
        return toAjax(industryEducationService.insertIndustryEducation(industryEducation));
    }

    @ApiOperation(value = "修改产教融合信息",httpMethod = "PUT")
    @PutMapping("/update")
    public AjaxResult update(@RequestBody IndustryEducation industryEducation) {
        return toAjax(industryEducationService.updateIndustryEducation(industryEducation));
    }

    @ApiOperation(value = "删除产教融合信息",httpMethod = "DELETE")
    @DeleteMapping("/delete/{id}")
    public AjaxResult delete(@PathVariable Integer id) {
        return toAjax(industryEducationService.deleteIndustryEducationById(id));
    }

}
